package com.sikaryofficial.backend.constant;

import cn.hutool.core.text.CharSequenceUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author : qinjinyuan
 * @desc : 产品款式
 * @date : 2023/10/31 19:23
 */
@Getter
@AllArgsConstructor
public enum ProductStyleEnum {

    /**
     * 款式: style:disposable 一次性
     */
    DISPOSABLE("disposable", "一次性"),
    /**
     * cartridge 弹药筒
     */
    CARTRIDGE("cartridge", "弹药筒"),
    /**
     * opentype 开放式
     */
    OPENTYPE("opentype", "开放式"),
    ;
    private final String code;
    private final String desc;

    public static ProductStyleEnum getByCode(String code) {
        return Arrays.stream(ProductStyleEnum.values())
                .filter(pointRuleEnum -> CharSequenceUtil.equals(code, pointRuleEnum.getCode()))
                .findFirst().orElse(null);
    }

}
